home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK2.toast / Development Kits (Disc 2) / QuickTime / Sample Code / QuickTime™ codec example / examplecodec.r < prev    next >
Encoding:
Text File  |  1997-02-26  |  5.5 KB  |  260 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        examplecodec.r
  3.  
  4.     Copyright:    © 1991-1996 by Apple Computer, Inc., all rights reserved.
  5.  
  6. */
  7.  
  8. #define UseExtendedThingResource 1
  9.  
  10. #include "Types.r"
  11. #include "MPWTypes.r"
  12. #include "ImageCodec.r"
  13.  
  14. #define    exampleCodecFormatName            "Example - YUV"
  15.  
  16. #define    exampleCodecFormatType    'exmp'
  17.  
  18. #ifndef NOASM
  19.     #define NOASM 0
  20. #endif
  21.  
  22. #ifndef COMP_BUILD
  23.     #define COMP_BUILD 0
  24. #endif
  25.  
  26. #ifndef DECO_BUILD
  27.     #define DECO_BUILD 0
  28. #endif
  29.  
  30. #if (DECO_BUILD == 0) && (COMP_BUILD == 0)
  31.     you need to build something....;
  32. #endif
  33.  
  34. /*
  35.  
  36.     This structure defines the capabilities of the codec. 
  37.     
  38. */
  39. #if    (defined(POWERPC_FAT)) | (!defined(POWERPC_NATIVE))
  40. resource 'cdci' (128, "Example CodecInfo",locked) {
  41.     exampleCodecFormatName,                            /* name of the codec TYPE ( data format ) */
  42.     1,                                                /* version */                            
  43.     1,                                                /* revision */    
  44.     'appl',                                            /* who made this codec */
  45.     codecInfoDoes32 + codecInfoDoesSpool,                /* depth and etc. supported directly on decompress */    
  46.     codecInfoDoes32 + codecInfoDoesSpool,                /* depth and etc supported directly on compress */
  47.     codecInfoDepth16,                                /* which data formats do we understand */
  48.     100,                                            /* compress accuracy (0-255) (relative to format) */
  49.     100,                                            /* decompress accuracy (0-255) (relative to format) */
  50. #if NOASM
  51.     200,                                            /* millisecs to compress 320x240 image on base Mac */
  52.     200,                                            /* millisecs to decompress 320x240 image on base Mac */
  53. #else
  54.     100,                                            /* millisecs to compress 320x240 image on base Mac */
  55.     100,                                            /* millisecs to decompress 320x240 image on base Mac */
  56. #endif
  57.     100,                                            /* compression level (0-255) (relative to format) */
  58.     0,                                
  59.     2,                                                /* minimum height */
  60.     2,                                                /* minimum width */
  61.     0,
  62.     0,
  63.     0
  64. };
  65. #endif
  66.  
  67. #ifdef POWERPC_NATIVE
  68. resource 'cdci' (129, "Example CodecInfo",locked) {
  69.     exampleCodecFormatName,                            /* name of the codec TYPE ( data format ) */
  70.     1,                                                /* version */                            
  71.     1,                                                /* revision */    
  72.     'appl',                                            /* who made this codec */
  73.     codecInfoDoes32 + codecInfoDoesSpool,                /* depth and etc. supported directly on decompress */    
  74.     codecInfoDoes32 + codecInfoDoesSpool,                /* depth and etc supported directly on compress */
  75.     codecInfoDepth16,                                /* which data formats do we understand */
  76.     100,                                            /* compress accuracy (0-255) (relative to format) */
  77.     100,                                            /* decompress accuracy (0-255) (relative to format) */
  78.     100,                                            /* millisecs to compress 320x240 image on base Mac */
  79.     100,                                            /* millisecs to decompress 320x240 image on base Mac */
  80.     100,                                            /* compression level (0-255) (relative to format) */
  81.     0,                                
  82.     2,                                                /* minimum height */
  83.     2,                                                /* minimum width */
  84.     0,
  85.     0,
  86.     0
  87. };
  88. #endif
  89.  
  90. #if COMP_BUILD
  91. resource 'thng' (128,  "Example Compressor",locked) {
  92.     compressorComponentType,
  93.     exampleCodecFormatType,
  94.     'appl',
  95. #if    (!defined(POWERPC_FAT)) & (defined(POWERPC_NATIVE))
  96.     0x80000000,
  97. #else
  98.     codecInfoDoes32,
  99. #endif
  100.     0,
  101.     'cdec',
  102.     128,
  103.     'STR ',
  104.     128,
  105.     'STR ',
  106.     129,
  107.     'ICON',
  108.     128,
  109.     0,
  110. #ifdef    POWERPC_NATIVE
  111.     componentHasMultiplePlatforms | 
  112. #endif
  113.     componentDoAutoVersion,
  114.     0,
  115.     {
  116. #ifdef    POWERPC_NATIVE
  117. #ifdef    POWERPC_FAT
  118.         codecInfoDoes32,
  119.         'cdec',
  120.         128,
  121.         1,
  122. #endif
  123.         codecInfoDoes32,
  124.         'cdek',
  125.         128,
  126.         2,
  127. #endif
  128.     },
  129. };
  130.  
  131. resource 'ICON' (128, purgeable) {
  132.     $"0003 8000 0004 C000 0004 C000 0004 C000"
  133.     $"0004 C000 0004 C000 0004 C000 0004 C000"
  134.     $"0004 C000 0004 C000 0004 C000 0004 C000"
  135.     $"0004 C000 0004 C000 0004 C000 0004 C000"
  136.     $"0004 C000 0004 C000 0004 C000 0007 C000"
  137.     $"0008 6000 0018 7000 007F FC00 00C0 1E00"
  138.     $"0180 1F00 0100 0F00 0100 0F00 0300 0F80"
  139.     $"0200 0F80 03FF FF80 0C00 0FE0 0FFF FFE0"
  140. };
  141.  
  142. resource 'STR ' (128) {
  143.     "My Example Compressor"
  144. };
  145.  
  146. resource 'STR ' (129) {
  147.     "Compresses (in an exemplar fasion) an image into a YUVish format."
  148. };
  149.  
  150.  
  151. #endif // COMP_BUILD
  152.  
  153. #if DECO_BUILD
  154. resource 'thng' (130,  "Example Decompressor",locked) {
  155.     decompressorComponentType,
  156.     exampleCodecFormatType,
  157.     'appl',
  158. #if    (!defined(POWERPC_FAT)) & (defined(POWERPC_NATIVE))
  159.     0x80000000,
  160. #else
  161.     codecInfoDoes32,
  162. #endif
  163.     0,
  164.     'cdec',
  165.     129,
  166.     'STR ',
  167.     130,
  168.     'STR ',
  169.     131,
  170.     'ICON',
  171.     130,
  172.     0,
  173. #ifdef    POWERPC_NATIVE
  174.     componentHasMultiplePlatforms | 
  175. #endif
  176.     componentDoAutoVersion,
  177.     0,
  178.     {
  179. #ifdef    POWERPC_NATIVE
  180. #ifdef    POWERPC_FAT
  181.         codecInfoDoes32,
  182.         'cdec',
  183.         129,
  184.         1,
  185. #endif
  186.         codecInfoDoes32,
  187.         'cdek',
  188.         129,
  189.         2
  190. #endif
  191.     }
  192. };
  193.  
  194. resource 'ICON' (130, purgeable) {
  195.     $"0200 0F80 03FF FF80 0C00 0FE0 0FFF FFE0"
  196.     $"0180 1F00 0100 0F00 0100 0F00 0300 0F80"
  197.     $"0008 6000 0018 7000 007F FC00 00C0 1E00"
  198.     $"0004 C000 0004 C000 0004 C000 0007 C000"
  199.     $"0004 C000 0004 C000 0004 C000 0004 C000"
  200.     $"0004 C000 0004 C000 0004 C000 0004 C000"
  201.     $"0004 C000 0004 C000 0004 C000 0004 C000"
  202.     $"0003 8000 0004 C000 0004 C000 0004 C000"
  203. };
  204.  
  205. resource 'STR ' (130) {
  206.     "My Example Decompressor"
  207. };
  208.  
  209. resource 'STR ' (131) {
  210.     "Decompresses an image compressed in YUVish format."
  211. };
  212.  
  213.  
  214. #endif DECO_BUILD
  215.  
  216.  
  217. #ifndef MW_REZ
  218.  
  219.     #ifdef    POWERPC_NATIVE
  220.     
  221.         #if COMP_BUILD
  222.             read 'cdek' (128, "Example Compressor") COMPPPC;
  223.         #endif
  224.         
  225.         #if DECO_BUILD
  226.             read 'cdek' (129, "Example Decompressor") DECOPPC;
  227.         #endif
  228.     
  229.     #endif // POWERPC_NATIVE
  230.     
  231.     #if    (defined(POWERPC_FAT)) | (!defined(POWERPC_NATIVE))
  232.         #if COMP_BUILD
  233.             
  234.             data 'cdec' (128, "Example Compressor") {
  235.             
  236.                 $$resource(COMP68K, 'cdec', 128);
  237.             
  238.             };
  239.         #endif
  240.         
  241.         #if DECO_BUILD
  242.             data 'cdec' (129, "Example Decompressor") {
  243.             
  244.                 $$resource(DECO68K, 'cdec', 129);
  245.             
  246.             };
  247.         #endif
  248.     
  249.     #endif
  250.     
  251.     #if USE_INIT_STUB
  252.         data 'INIT' (0) {
  253.         
  254.             $$resource(INITSTUB, 'INIT', 0);
  255.         
  256.         };
  257.     #endif
  258.  
  259. #endif // MW_REZ
  260.